/**
*	Javascript que configura automaticamente diversos elementos da tela
*	@author Kael Santini
*	@since 23/05/2012
**/
$(function(){

	$("form.autoconfigure").each(function(){
	
		var $form = $(this);
		
		$form.submit(function(){
		
			$.ajax({
				"url" : $form.attr("action"),
				"data": $form.serialize(),
				"type" : $form.attr("method"),
				"dataType" : "json",
				"success": function(retorno){
					
					$form.find("input[name=id]:hidden").val(retorno.id);
					
				}
			});
			
			return false;
			
		});
			
	
	});

});

